THE LINEAR QUAD-TREE
Decoding procedure:
a) to convert from code to x,y location
- transform code into binary
- odd bits give the x coordinate, even bits give y coordinate
example: code = 44
binary representation 1 0 1 1 0 0
odd bits x = 0 1 0 = 2 in base 10
even bits y = 1 1 0 = 6 in base 10
Also not that the position of 44 using levels is: level 1 (2), level 2 (3), level 3 (0).
In binary this code would be 10 11 00 or 44, the code value!
Write a Morton sequence to store the above matrix.
00 00 00,w; 00 01 00,w; 00 01 01,w; 00 01 10,w; 00 01 11,b; 00 10 00,w; 00 11 00,b;
01 00 00,w; 01 01 00,w; 01 10 00,w; 01 10 01,b; 01 10 10,w; 01 10 11,b; 01 11 00,b;
10 00 00,w;
11 00 00,w; 11 00 01,b; 11 00 10,w; 11 00 11,w; 11 01 00,b; 11 10 00,w; 11 11 00,w.
Storage savings 64 bytes for all cells, 22 bytes for Morton sequence a 65% savings.